﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace JWBSTAPP.CommonClass
{
    public class JsonString
    {
        public static string AddAttribute(string jsonString, Hashtable hashtable)
        {
            if (String.IsNullOrEmpty(jsonString))
                return null;
            foreach (DictionaryEntry item in hashtable)
                jsonString = jsonString.Insert(jsonString.Length - 1, ",\"" + item.Key + "\":\"" + item.Value + "\"");
            return jsonString;
        }
        public static string MergeJson(string json1, string json2)
        {
            if (string.IsNullOrEmpty(json1))
            {
                json1 = "{}";
            }
            if (string.IsNullOrEmpty(json2))
            {
                json2 = "{}";
            }
            return json1.Substring(0, json1.Length - 1) + "," + json2.Substring(1, json2.Length - 1);
        }

    }
}